package com.Rolin.wss.controller;

import com.Rolin.wss.model.UserVO;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;


/**
 * 首页处理器，负责处理首页事件
 */
@Controller
public class IndexController {

    @RequestMapping(value = "/index")
    public String jumpHome(HttpSession session, Model model){
        UserVO user = (UserVO) session.getAttribute("user");
        if(user != null) {
            model.addAttribute("userCome","<a class=\"come\">欢迎您，"+user.getUser_phone()+"</a><a class=\"come\" href=\"/wss/user/logout\"  style=\"margin-right:60px\">登出</a>");
        }else{
            model.addAttribute("userCome","<a class=\"come\" href=\"/wss/user/login\">登录/注册</a>");
        }

        return "index";
    }
}
